package ui;

import org.uqbar.arena.layout.VerticalLayout;
import org.uqbar.arena.widgets.Container;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.WindowOwner;
import org.uqbar.arena.windows.Window;
import org.uqbar.commons.utils.Home;
import org.uqbar.commons.utils.ApplicationContext;
import org.uqbar.arena.widgets.tables.Column;
import org.uqbar.arena.widgets.tables.Table;

import Aplicacion.Captura;
import Homes.CapturasHome;

@SuppressWarnings("serial")
public class ConsultarPendientesWindow extends Window<Home<Captura>> {

	private Container mainPanel;

	public ConsultarPendientesWindow(WindowOwner parent, CapturasHome capturasHome) {
		super(parent, ApplicationContext.getInstance().getHome(Captura.class));
		this.setTitle("Foto Multas Application");
	}

	@Override
	public void createContents(Panel mainPanel) {
		this.mainPanel = mainPanel;
		mainPanel.setLayout(new VerticalLayout());		
		this.createCapturasGrid();
	} 

	private void createCapturasGrid() {
		Table<Captura> table = new Table<Captura>(this.mainPanel, Captura.class);
		table.bindContentsToProperty(Home.OBJECTS);

		new Column<Captura>(table)
			.setTitle("Infraccion")
			.setFixedSize(200)
			.bindContentsToProperty("infraccionNombre");
		
		new Column<Captura>(table)
			.setTitle("Vehículo")
			.setFixedSize(200)
			.bindContentsToProperty("vehiculoPatente");
	}
		
}
